/*
 * Copyright 2007 - The JDPF Project Team (http://www.jdpf.org) 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */
package org.jdpf.core.plugins.registration;

import java.util.Properties;

import org.jdpf.core.plugins.blocks.AbstractTransitionPlugin;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

/**
 * The interface implemented by a published service that can itself publish
 * other services of the same type when someone ask for them.
 * 
 * @author Paolo Mauri
 * 
 */
public interface RegistrationService {

	/**
	 * Set the proper bundle context to use when the registration service has to
	 * register a new service.
	 * 
	 * @param context  The bundle context
	 */
	public void setBundleContext(BundleContext context);

	/**
	 * Method to have a bundle registering a new service
	 * 
	 * @param transitionId -
	 *            the <code>id</code> of the new transition in the service
	 * @param transitionName -
	 *            the <code>name</code> of the new transition in the service
	 * @return a new AbstractPlugin published as a service
	 */
	public AbstractTransitionPlugin newInstance(String transitionId,
			String transitionName);

	/**
	 * @return The actual service registration
	 */
	public ServiceRegistration getServiceRegistration(String serviceId);
	
	public void unregister(String id);
	
	public ServiceRegistration doRegistration(AbstractTransitionPlugin service, Properties prop);

}
